interface Car {
  type: "car";
  brand: string;
  wheels: number;
}

interface Bicycle {
  type: "bicyle";
  color: string;
}

interface Motorcycle {
  type: "motorcycle";
  engine: number;
}

type Vehicle = Car | Bicycle | Motorcycle;

function pringVehicleInfo(vehicle: Vehicle) {
  switch (vehicle.type) {
    case "car":
      console.log(`Brand:${vehicle.brand}, wheels:${vehicle.wheels}`);
      break;
    case "bicyle":
      console.log(`Color: ${vehicle.color}`);
      break;
    case "motorcycle":
      console.log(`Engine:${vehicle.engine}`);
      break;
    default:
      const _exhaustiveCheck: never = vehicle;
  }
}

const car: Car = { type: "car", brand: "Toyota", wheels: 5 };
const bicyle: Bicycle = { type: "bicyle", color: "red" };
const motorcycle: Motorcycle = { type: "motorcycle", engine: 1000 };

console.log(car);
console.log(bicyle);
console.log(motorcycle);
